package org.testis.testdriver.operations;

import org.testis.testdriver.*;
import org.testis.testdriver.AtofEnumaration.DebuggingMode;


/**
 * This class is the TestPartOperation Decorator to return the result of TestPart
 * object. This class always must be last class of the decorator linkage. 
 * 
 * @author barisergun
 */
public class TestPartOperationReturnPartResult extends TestPartOperationDecorator
{

    private TestPart partInUse;


    public TestPartOperationReturnPartResult(TestPart testPart)
    {
        partInUse = testPart;
    }


    @Override
    public boolean runOperation(DebuggingMode mode) throws InterruptedException
    {
        if (super.runOperation(mode)) {
            return runSpecificBehaviour();
        }
        else {
            return false;
        }
    }


    /**
     * This method is used to drive the specific Tasks that belong to this decorator
     * operation.
     * 
     * @return boolean the result of operation. This result will affect the operation
     * of linked decorator tasks. 
     */
    private boolean runSpecificBehaviour()
    {
        return partInUse.getTestPartResult();
    }
}
